of the code base legal C and C++ at the same time.
This means that things are quite non-C++ right now, but you can only fight
battles on so many fronts...
TEMPLATE = app
-MINIMAL_FMTS = magproto.c gpx.c geo.c mapsend.c mapsource.c garmin.c \
- garmin_device_xml.c garmin_tables.c internal_styles.c nmea.c \
- kml.c wbt-200.c
-
-ALL_FMTS=$$MINIMAL_FMTS gtm.c gpsutil.c pcx.c cetus.c copilot.c \
- gpspilot.c magnav.c skytraq.c \
- psp.c holux.c tmpro.c tpg.c tpo.c \
- xcsv.c gcdb.c tiger.c easygps.c quovadis.c \
- gpilots.c saroute.c navicache.c psitrex.c geoniche.c delgpl.c \
- ozi.c text.c html.c palmdoc.c netstumbler.c hsa_ndv.c \
- igc.c brauniger_iq.c shape.c hiketech.c glogbook.c coastexp.c \
- vcf.c overlay.c google.c xhtmlent.c lowranceusr.c an1.c tomtom.c \
- tef_xml.c maggeo.c pathaway.c vitosmt.c gdb.c bcr.c coto.c \
- ignrando.c stmwpp.c msroute.c cst.c nmn4.c mag_pdb.c compegps.c \
- yahoo.c unicsv.c wfff_xml.c garmin_txt.c axim_gpb.c gpssim.c \
- stmsdf.c gtrnctr.c dmtlog.c raymarine.c alan.c vitovtt.c \
- ggv_log.c g7towin.c garmin_gpi.c lmx.c random.c xol.c dg-100.c \
- navilink.c mtk_logger.c ik3d.c osm.c destinator.c exif.c vidaone.c \
- igo8.c gopal.c humminbird.c mapasia.c gnav_trl.c navitel.c ggv_ovl.c \
- jtr.c sbp.c sbn.c mmo.c skyforce.c itracku.c v900.c delbin.c \
- pocketfms_bc.c pocketfms_fp.c pocketfms_wp.c naviguide.c enigma.c \
- vpl.c teletype.c jogmap.c bushnell.c bushnell_trl.c wintec_tes.c \
- subrip.c garmin_xt.c explorist_ini.c \
-
-FILTERS=position.c radius.c duplicate.c arcdist.c polygon.c smplrout.c \
- reverse_route.c sort.c stackfilter.c trackfilter.c discard.c \
- nukedata.c interpolate.c transform.c height.c swapdata.c
-
-SHAPE=shapelib/shpopen.c shapelib/dbfopen.c pdbfile.c
+XMINIMAL_FMTS = magproto.cc gpx.cc geo.cc mapsend.cc mapsource.cc garmin.cc \
+ garmin_device_xml.cc garmin_tables.cc internal_styles.cc nmea.cc \
+ kml.cc wbt-200.cc
+
+XALL_FMTS=$$MINIMAL_FMTS gtm.cc gpsutil.cc pcx.cc cetus.cc copilot.cc \
+ gpspilot.cc magnav.cc skytraq.cc \
+ psp.cc holux.cc tmpro.cc tpg.cc tpo.cc \
+ xcsv.cc gcdb.cc tiger.cc easygps.cc quovadis.cc \
+ gpilots.cc saroute.cc navicache.cc psitrex.cc geoniche.cc delgpl.cc \
+ ozi.cc text.cc html.cc palmdoc.cc netstumbler.cc hsa_ndv.cc \
+ igc.cc brauniger_iq.cc shape.cc hiketech.cc glogbook.cc coastexp.cc \
+ vcf.cc overlay.cc google.cc xhtmlent.cc lowranceusr.cc an1.cc tomtom.cc \
+ tef_xml.cc maggeo.cc pathaway.cc vitosmt.cc gdb.cc bcr.cc coto.cc \
+ ignrando.cc stmwpp.cc msroute.cc cst.cc nmn4.cc mag_pdb.cc compegps.cc \
+ yahoo.cc unicsv.cc wfff_xml.cc garmin_txt.cc axim_gpb.cc gpssim.cc \
+ stmsdf.cc gtrnctr.cc dmtlog.cc raymarine.cc alan.cc vitovtt.cc \
+ ggv_log.cc g7towin.cc garmin_gpi.cc lmx.cc random.cc xol.cc dg-100.cc \
+ navilink.cc mtk_logger.cc ik3d.cc osm.cc destinator.cc exif.cc vidaone.cc \
+ igo8.cc gopal.cc humminbird.cc mapasia.cc gnav_trl.cc navitel.cc ggv_ovl.cc \
+ jtr.cc sbp.cc sbn.cc mmo.cc skyforce.cc itracku.cc v900.cc delbin.cc \
+ pocketfms_bc.cc pocketfms_fp.cc pocketfms_wp.cc naviguide.cc enigma.cc \
+ vpl.cc teletype.cc jogmap.cc bushnell.cc bushnell_trl.cc wintec_tes.cc \
+ subrip.cc garmin_xt.cc explorist_ini.cc \
+ALL_FMTS=$$MINIMAL_FMTS
+FILTERS=position.cc radius.cc duplicate.cc arcdist.cc polygon.cc smplrout.cc \
+ reverse_route.cc sort.cc stackfilter.cc trackfilter.cc discard.cc \
+ nukedata.cc interpolate.cc transform.cc height.cc swapdata.cc
+
+SHAPE=shapelib/shpopen.c shapelib/dbfopen.c pdbfile.cc
ZLIB=zlib/adler32.c zlib/compress.c zlib/crc32.c zlib/deflate.c zlib/inffast.c \
zlib/inflate.c zlib/infback.c zlib/inftrees.c zlib/trees.c \
zlib/uncompr.c zlib/gzio.c zlib/zutil.c
-JEEPS += jeeps/gpsapp.c jeeps/gpscom.c \
- jeeps/gpsmath.c jeeps/gpsmem.c \
- jeeps/gpsprot.c jeeps/gpsread.c \
- jeeps/gpsdevice.c jeeps/gpsdevice_ser.c jeeps/gpsdevice_usb.c \
- jeeps/gpsrqst.c jeeps/gpssend.c jeeps/gpsserial.c jeeps/jgpsutil.c \
- jeeps/gpsusbread.c jeeps/gpsusbsend.c \
- jeeps/gpsusbcommon.c
+JEEPS += jeeps/gpsapp.cc jeeps/gpscom.cc \
+ jeeps/gpsmath.cc jeeps/gpsmem.cc \
+ jeeps/gpsprot.cc jeeps/gpsread.cc \
+ jeeps/gpsdevice.cc jeeps/gpsdevice_ser.cc jeeps/gpsdevice_usb.cc \
+ jeeps/gpsrqst.cc jeeps/gpssend.cc jeeps/gpsserial.cc jeeps/jgpsutil.cc \
+ jeeps/gpsusbread.cc jeeps/gpsusbsend.cc \
+ jeeps/gpsusbcommon.cc
-SUPPORT = queue.c route.c waypt.c filter_vecs.c util.c vecs.c mkshort.c \
- csv_util.c strptime.c grtcirc.c vmem.c util_crc.c xmlgeneric.c \
- uuid.c formspec.c xmltag.c cet.c cet_util.c fatal.c rgbcolors.c \
- inifile.c garmin_fs.c gbsleep.c units.c gbser.c \
- gbfile.c parse.c avltree.c session.c main.c globals.c
+SUPPORT = queue.cc route.cc waypt.cc filter_vecs.cc util.cc vecs.cc mkshort.cc \
+ csv_util.cc strptime.c grtcirc.cc vmem.cc util_crc.cc xmlgeneric.cc \
+ uuid.cc formspec.cc xmltag.cc cet.cc cet_util.cc fatal.cc rgbcolors.cc \
+ inifile.cc garmin_fs.cc gbsleep.cc units.cc gbser.cc \
+ gbfile.cc parse.cc avltree.cc session.cc main.cc globals.cc
SUBDIRS += jeeps
macx|linux {
DEFINES += HAVE_NANOSLEEP HAVE_LIBUSB HAVE_LIBEXPAT HAVE_GLOB
DEFINES += HAVE_VA_COPY HAVE_VA_LIST_AS_ARRAY
- SOURCES += gbser_posix.c jeeps/gpslibusb.c
+ SOURCES += gbser_posix.cc jeeps/gpslibusb.cc
INCLUDEPATH += jeeps
LIBS += -lexpat
}
win32 {
- SOURCES += gbser_win32.c jeeps/gpsusbwin.c
+ SOURCES += gbser_win32.cc jeeps/gpsusbwin.c
}
linux {
SOURCES += $$ALL_FMTS $$FILTERS $$SUPPORT $$SHAPE $$ZLIB $$JEEPS
# We don't care about stripping things out of the build. Full monty, baby.
-DEFINES += MAXIMAL_ENABLED
+#DEFINES += MAXIMAL_ENABLED
DEFINES += FILTERS_ENABLED
-DEFINES += PDBFMTS_ENABLED
-DEFINES += SHAPELIB_ENABLED
-DEFINES += CSVFMTS_ENABLED
-DEFINES += CET_WANTED
+#DEFINES += PDBFMTS_ENABLED
+#DEFINES += SHAPELIB_ENABLED
+#DEFINES += CSVFMTS_ENABLED
+#DEFINES += CET_WANTED
*oldurlstr = 0;
}
- wpt->url = xcalloc(len+1, 1);
+ wpt->url = (char*) xcalloc(len+1, 1);
memcpy(wpt->url, ofs, len);
ofs += len;
}
ofs += 2;
if (len) {
- wpt->comment = xcalloc(len+1, 1);
+ wpt->comment = (char*) xcalloc(len+1, 1);
memcpy(wpt->comment, ofs, len);
ofs += len;
}
rec->name = xstrdup(wpt->description);
if (!nogc && wpt->gc_data->id) {
- char *extra = xmalloc(25 + strlen(wpt->gc_data->placer) + strlen(wpt->shortname));
+ char *extra = (char *) xmalloc(25 + strlen(wpt->gc_data->placer) + strlen(wpt->shortname));
sprintf(extra, "\r\nBy %s\r\n%s (%1.1f/%1.1f)",
wpt->gc_data->placer,
wpt->shortname, wpt->gc_data->diff/10.0,
ff_vecs_t an1_vecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
+ (ff_cap) (ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_write /* tracks */,
- ff_cap_read | ff_cap_write /* routes */,
+ (ff_cap) (ff_cap_read | ff_cap_write) /* routes */,
},
rd_init,
wr_init,
struct defguid {
GUID guid;
- char *name;
+ const char *name;
} default_guids[] = {
{ {0xb610bc70,{0x377e, 0x11d6, 0xaeb3}, {0x00, 0x01, 0x02, 0x31, 0x5f, 0xfd}},
"Hiker"
if (n8 > tree->key_sz) {
if (tree->key_sz == 0) {
- tree->key = xmalloc(n8);
+ tree->key = (char*) xmalloc(n8);
} else {
- tree->key = xrealloc((char *)tree->key, n8);
+ tree->key = (char *) xrealloc((char *)tree->key, n8);
}
tree->key_sz = n8;
}
#define cet_ucs4_ofs_ansi_x3_4_1968 128
#define cet_ucs4_cnt_ansi_x3_4_1968 1
-const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968];
+const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968] = {};
#define cet_ucs4_to_ansi_x3_4_1968_ct 1
-const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_4_1968_ct];
+const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_4_1968_ct] = {};
// #define cet_ucs4_to_ansi_x3_4_1968_extra_ct 200
#define cet_ucs4_ofs_ibm891 128
#define cet_ucs4_cnt_ibm891 1
-const int cet_ucs4_map_ibm891[cet_ucs4_cnt_ibm891];
+const int cet_ucs4_map_ibm891[cet_ucs4_cnt_ibm891] = {};
#define cet_ucs4_to_ibm891_ct 1
-const cet_ucs4_link_t cet_ucs4_to_ibm891_links[cet_ucs4_to_ibm891_ct];
+const cet_ucs4_link_t cet_ucs4_to_ibm891_links[cet_ucs4_to_ibm891_ct] = {};
/*
#define cet_ucs4_to_ibm891_extra_ct 0
#define cet_ucs4_ofs_ibm903 128
#define cet_ucs4_cnt_ibm903 1
-const int cet_ucs4_map_ibm903[cet_ucs4_cnt_ibm903];
+const int cet_ucs4_map_ibm903[cet_ucs4_cnt_ibm903] = {};
#define cet_ucs4_to_ibm903_ct 1
-const cet_ucs4_link_t cet_ucs4_to_ibm903_links[cet_ucs4_to_ibm903_ct];
+const cet_ucs4_link_t cet_ucs4_to_ibm903_links[cet_ucs4_to_ibm903_ct] = {};
/*
#define cet_ucs4_to_ibm903_extra_ct 0
#define cet_ucs4_ofs_iso_8859_1 256
#define cet_ucs4_cnt_iso_8859_1 1
-const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1];
+const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1] = {};
#define cet_ucs4_to_iso_8859_1_ct 1
-const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_ct];
+const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_ct] = {};
/*
#define cet_ucs4_to_iso_8859_1_extra_ct 0
static signed int
cet_cs_alias_qsort_cb(const void *a, const void *b)
{
- const cet_cs_alias_t *va = a;
- const cet_cs_alias_t *vb = b;
+ const cet_cs_alias_t *va = (const cet_cs_alias_t*) a;
+ const cet_cs_alias_t *vb = (const cet_cs_alias_t*) b;
return case_ignore_strcmp(va->name, vb->name);
}
0,
NULL, /* extra */
0, /* extras */
+ NULL,
NULL
};
}
/* create name to vec table */
- list = xcalloc(c, sizeof(*list));
+ list = (cet_cs_alias_t*) xcalloc(c, sizeof(*list));
i = 0;
for (p = cet_cs_vec_root; p != NULL; p = p->next) {
if (p->alias != NULL) {
* Turns out plain old strcmp will do the trick...
*/
- htable = xmalloc(ct * sizeof(*htable));
+ htable = (struct hdr*) xmalloc(ct * sizeof(*htable));
bh = htable;
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
ff_vecs_t cetus_vecs = {
ff_type_file,
- { ff_cap_write | ff_cap_read, ff_cap_read, ff_cap_none },
+ { (ff_cap) (ff_cap_write | ff_cap_read), ff_cap_read, ff_cap_none },
rd_init,
wr_init,
rd_deinit,
struct record4 *rec;
char *vdata;
- rec = xcalloc(sizeof(*rec)+1141,1);
+ rec = (struct record4 *) xcalloc(sizeof(*rec)+1141,1);
pdb_write_double(&rec->latitude, RAD(wpt->latitude));
pdb_write_double(&rec->longitude, RAD(-wpt->longitude));
*/
xcsv_file.type = ff_type_file;
- xcsv_file.mkshort_handle = (struct short_handle *) mkshort_new_handle();
+ xcsv_file.mkshort_handle = mkshort_new_handle();
xcsv_file.gps_datum = GPS_DATUM_WGS84;
}
* All shortname functions take a shortname handle as the first arg.
* This is an opaque pointer. Callers must not fondle the contents of it.
*/
-typedef struct short_handle * short_handle;
+// This is a crutch until the new C++ shorthandle goes in.
+#define PRIME 37
+typedef struct {
+ unsigned int target_len;
+ char *badchars;
+ char *goodchars;
+ char *defname;
+ queue namelist[PRIME];
+
+ /* Various internal flags at end to allow alignment flexibility. */
+ unsigned int mustupper:1;
+ unsigned int whitespaceok:1;
+ unsigned int repeating_whitespaceok:1;
+ unsigned int must_uniq:1;
+ unsigned int is_utf8:1;
+} mkshort_handle_imp;
+typedef mkshort_handle_imp* short_handle;
+
#ifndef DEBUG_MEM
char *mkshort(short_handle, const char *);
-void *mkshort_new_handle(void);
+short_handle mkshort_new_handle(void);
#else
char *MKSHORT(short_handle, const char *, DEBUG_PARAMS);
void *MKSHORT_NEW_HANDLE(DEBUG_PARAMS);
*/
#define VMFL_NOZERO (1 << 0)
typedef struct vmem {
- void *mem; /* visible memory object */
+ char *mem; /* visible memory object */
size_t size; /* allocated size of object */
} vmem_t;
vmem_t vmem_alloc(size_t, int flags);
} ff_cap;
#define FF_CAP_RW_ALL \
- { ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write }
+ { (ff_cap) (ff_cap_read | ff_cap_write), (ff_cap) (ff_cap_read | ff_cap_write), (ff_cap) (ff_cap_read | ff_cap_write) }
#define FF_CAP_RW_WPT \
- { ff_cap_read | ff_cap_write, ff_cap_none, ff_cap_none}
+ { (ff_cap) (ff_cap_read | ff_cap_write), ff_cap_none, ff_cap_none}
/*
* Format capabilities for realtime positioning.
{
int receiver_short_length;
int receiver_must_upper = 1;
- char * receiver_charset = NULL;
+ const char * receiver_charset = NULL;
if (!mkshort_handle) {
mkshort_handle = mkshort_new_handle();
extern queue waypt_head;
int icon;
- tx_waylist = xcalloc(n,sizeof(*tx_waylist));
+ tx_waylist = (struct GPS_SWay**) xcalloc(n,sizeof(*tx_waylist));
for (i = 0; i < n; i++) {
tx_waylist[i] = sane_GPS_Way_New();
int i;
int n = 2 * route_waypt_count(); /* Doubled for the islink crap. */
- tx_routelist = xcalloc(n,sizeof(GPS_PWay));
+ tx_routelist = (struct GPS_SWay**) xcalloc(n,sizeof(GPS_PWay));
cur_tx_routelist_entry = tx_routelist;
for (i = 0; i < n; i++) {
int i;
int32 n = track_waypt_count() + track_count();
- tx_tracklist = xcalloc(n, sizeof(GPS_PTrack));
+ tx_tracklist = (struct GPS_STrack**) xcalloc(n, sizeof(GPS_PTrack));
cur_tx_tracklist_entry = tx_tracklist;
for (i = 0; i < n; i++) {
tx_tracklist[i] = GPS_Track_New();
if (my_gdx_info) {
fatal(MYNAME ": More than one device type found in file.\n");
}
- my_gdx_info = xcalloc(sizeof *my_gdx_info, 1);
+ my_gdx_info = (gdx_info*) xcalloc(sizeof *my_gdx_info, 1);
my_gdx_info->device_desc = xstrdup(args);
}
{ ext_s, cb_cdata, "/Device/MassStorageMode/DataType/File/Location/FileExtension" },
{ base_s, cb_cdata, "/Device/MassStorageMode/DataType/File/Location/BaseName" },
{ dir_s, cb_cdata, "/Device/MassStorageMode/DataType/File/TransferDirection" },
- { 0, 0, NULL }
+ { 0, (xg_cb_type) 0, NULL }
};
const gdx_info *
{ "bng", "British National Grid", grid_bng },
{ "utm", "UTM", grid_utm },
{ "swiss", "Swiss grid", grid_swiss },
- { NULL, NULL, 0 }
+ { NULL, NULL, (grid_type) 0 }
};
/* gt_mps_datum_names: */
fd = stdout;
}
SET_BINARY_MODE(fd);
- self->handle.gz = gzdopen(fileno(fd), openmode);
+ self->handle.gz = (void **)gzdopen(fileno(fd), openmode);
} else {
- self->handle.gz = gzopen(self->name, openmode);
+ self->handle.gz = (void **)gzopen(self->name, openmode);
}
if (self->handle.gz == NULL) {
gzapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self)
{
int result = 0;
- char *target = buf;
+ char *target = (char*) buf;
int count = size * members;
if (self->back != -1) {
if (self->mempos + count > self->memsz) {
self->memsz = ((self->mempos + count + 4095) / 4096) * 4096;
- self->handle.mem = xrealloc(self->handle.mem, self->memsz);
+ self->handle.mem = (unsigned char*) xrealloc(self->handle.mem, self->memsz);
}
memcpy(self->handle.mem + self->mempos, buf, count);
self->mempos += count;
const char *m;
int len;
- file = xcalloc(1, sizeof(*file));
+ file = (gbfile*) xcalloc(1, sizeof(*file));
file->module = xstrdup(module);
file->mode = 'r'; // default
#else
file->buffsz = 256;
#endif
- file->buff = xmalloc(file->buffsz);
+ file->buff = (char *) xmalloc(file->buffsz);
return file;
}
file->buffsz *= 2;
}
- file->buff = xrealloc(file->buff, file->buffsz);
+ file->buff = (char*) xrealloc(file->buff, file->buffsz);
}
return gbfwrite(file->buff, 1, len, file);
}
if (len == file->buffsz) {
file->buffsz += 64;
- str = file->buff = xrealloc(file->buff, file->buffsz + 1);
+ str = file->buff = (char*) xrealloc(file->buff, file->buffsz + 1);
}
str[len] = c;
len++;
char *result;
len = gbfgetc(file);
- result = xmalloc(len + 1);
+ result = (char *) xmalloc(len + 1);
if (len > 0) {
gbfread(result, 1, len, file);
}
if (len+clen >= file->buffsz) {
file->buffsz += 64;
- result = file->buff = xrealloc(file->buff, file->buffsz + 1);
+ result = file->buff = (char*) xrealloc(file->buff, file->buffsz + 1);
}
memcpy(&result[len], buff, clen);
len += clen;
if ((len + 1) == file->buffsz) {
file->buffsz += 64;
- result = file->buff = xrealloc(file->buff, file->buffsz + 1);
+ result = file->buff = (char*) xrealloc(file->buff, file->buffsz + 1);
}
result[len] = (char)c;
len++;
*/
int gbser_read_line(void *handle, void *buf, unsigned len, unsigned ms, int eol, int discard)
{
- char *bp = buf;
+ char *bp = (char *) buf;
unsigned pos = 0;
hp_time tv;
get_time(&tv);
{ wpt_diff, cb_cdata, "/loc/waypoint/difficulty" },
{ wpt_terr, cb_cdata, "/loc/waypoint/terrain" },
{ wpt_container,cb_cdata, "/loc/waypoint/container" },
- { NULL, 0, NULL }
+ { NULL, (xg_cb_type)0, NULL }
};
void wpt_s(const char *args, const char **unused)
ff_vecs_t geo_vecs = {
ff_type_file,
- { ff_cap_read | ff_cap_write, ff_cap_none, ff_cap_none },
+ { (ff_cap) (ff_cap_read | ff_cap_write), ff_cap_none, ff_cap_none },
geo_rd_init,
geo_wr_init,
geo_rd_deinit,
struct record *rec;
char *vdata;
- rec = xcalloc(sizeof(*rec)+206,1);
+ rec = (struct record*) xcalloc(sizeof(*rec)+206,1);
be_write32(&rec->longitude, si_round(wpt->longitude * 3.6e6));
be_write32(&rec->latitude, si_round(wpt->latitude * 3.6e6));
} tag_type;
typedef struct {
- queue queue;
+ struct queue queue;
char *tagdata;
} gpx_global_entry;
}
}
- gep = xcalloc(sizeof(*gep), 1);
+ gep = (gpx_global_entry*) xcalloc(sizeof(*gep), 1);
QUEUE_INIT(&gep->queue);
gep->tagdata = xstrdup(cdata);
ENQUEUE_TAIL(&ge->queue, &gep->queue);
typedef struct tag_mapping {
- tag_type tag_type; /* enum from above for this tag */
+ tag_type tag_type_; /* enum from above for this tag */
int tag_passthrough; /* true if we don't generate this */
const char *tag_name; /* xpath-ish tag name */
unsigned long crc; /* Crc32 of tag_name */
{ tt_vdop, 0, "/gpx/wpt/vdop", 0UL },
{ tt_vdop, 0, "/gpx/trk/trkseg/trkpt/vdop", 0UL },
{ tt_vdop, 0, "/gpx/rte/rtept/hdop", 0UL },
- {0, 0, NULL, 0UL}
+ {(tag_type)0, 0, NULL, 0UL}
};
static tag_type
tag_mapping *tm;
unsigned long tcrc = get_crc32_s(t);
- for (tm = tag_path_map; tm->tag_type != 0; tm++) {
+ for (tm = tag_path_map; tm->tag_type_ != 0; tm++) {
if ((tcrc == tm->crc) && (0 == strcmp(tm->tag_name, t))) {
*passthrough = tm->tag_passthrough;
- return tm->tag_type;
+ return tm->tag_type_;
}
}
*passthrough = 1;
prescan_tags(void)
{
tag_mapping *tm;
- for (tm = tag_path_map; tm->tag_type != 0; tm++) {
+ for (tm = tag_path_map; tm->tag_type_ != 0; tm++) {
tm->crc = get_crc32_s(tm->tag_name);
}
}
if ((wpt_tmp->shortname) && (strlen(wpt_tmp->shortname) > 2)) {
/* copy of the shortname */
- lwp_tmp->shortname = xcalloc(7, 1);
+ lwp_tmp->shortname = (char *) xcalloc(7, 1);
sprintf(lwp_tmp->shortname, "%-4.4s%02d",
&wpt_tmp->shortname[2], logpoint_ct++);
wpt_tmp->sat = atof(cdatastrp);
break;
case tt_fix:
- wpt_tmp->fix = atoi(cdatastrp)-1;
+ wpt_tmp->fix = (fix_type)(atoi(cdatastrp)-1);
if (wpt_tmp->fix < fix_2d) {
if (!case_ignore_strcmp(cdatastrp, "none")) {
wpt_tmp->fix = fix_none;
cdatalen = &(cur_tag->cdatalen);
}
estr = *cdata;
- *cdata = xrealloc(*cdata, *cdatalen + len + 1);
+ *cdata = (char*) xrealloc(*cdata, *cdatalen + len + 1);
estr = *cdata + *cdatalen;
memcpy(estr, s, len);
*(estr+len) = '\0';
}
if (NULL == gpx_global) {
- gpx_global = xcalloc(sizeof(*gpx_global), 1);
+ gpx_global = (struct gpx_global*) xcalloc(sizeof(*gpx_global), 1);
QUEUE_INIT(&gpx_global->name.queue);
QUEUE_INIT(&gpx_global->desc.queue);
QUEUE_INIT(&gpx_global->author.queue);
#if HAVE_LIBEXPAT
int len;
int done = 0;
- char *buf = xmalloc(MY_CBUF_SZ);
+ char *buf = (char*) xmalloc(MY_CBUF_SZ);
int result = 0;
int extra;
return NULL;
}
- val = xmalloc(len+1);
+ val = (char *) xmalloc(len+1);
gbfread(val, 1, len, fd);
while (len != 0 && val[len-1] == ' ') {
len--;
static char *
fread_fixedstring(gbfile *fd, int len)
{
- char *val = xmalloc(len+1);
+ char *val = (char *) xmalloc(len+1);
gbfread(val, 1, len, fd);
while (len != 0 && val[len-1] == ' ') {
}
len = strlen(path);
- buff = xmalloc(len + 1 + strlen(GPSBABEL_INIFILE) + 1);
+ buff = (char*) xmalloc(len + 1 + strlen(GPSBABEL_INIFILE) + 1);
strcpy(buff, path);
if (len > 0) {
char test = buff[len - 1];
if ((envstr = getenv("HOME")) != NULL) {
char *path;
- path = xmalloc(strlen(envstr) + 11);
+ path = (char*) xmalloc(strlen(envstr) + 11);
strcpy(path, envstr);
strcat(path, "/.gpsbabel");
name = find_gpsbabel_inifile(path);
itracku_device_read_string()
{
const int size = 1024;
- char* s = xmalloc(size);
+ char* s = (char*) xmalloc(size);
gbser_read_line(fd, s, size, 1000, 0, 0);
dbg(1, "read from device: %s", s);
return s;
ff_vecs_t itracku_fvecs = {
ff_type_file,
{
- ff_cap_read | ff_cap_write /* waypoints */,
- ff_cap_read | ff_cap_write /* tracks */,
+ (ff_cap) (ff_cap_read | ff_cap_write) /* waypoints */,
+ (ff_cap) (ff_cap_read | ff_cap_write) /* tracks */,
ff_cap_none /* routes */
},
itracku_rd_init,
* OS implementation.
*/
#define GUSB_MAX_UNITS 20
-struct garmin_unit_info {
+typedef struct {
unsigned long serial_number;
unsigned long unit_id;
unsigned long unit_version;
char *os_identifier; /* In case the OS has another name for it. */
char *product_identifier; /* From the hardware itself. */
-} garmin_unit_info[GUSB_MAX_UNITS];
+} garmin_unit_info_t;
+
+extern garmin_unit_info_t garmin_unit_info[GUSB_MAX_UNITS];
int gusb_cmd_send(const garmin_usb_packet *obuf, size_t sz);
int gusb_cmd_get(garmin_usb_packet *ibuf, size_t sz);
#ifdef __cplusplus
-extern "C"
-{
+// extern "C"
+//{
#endif
#ifndef gps_h
#include "gpsinput.h"
#include "gpsproj.h"
- time_t gps_save_time;
- double gps_save_lat;
- double gps_save_lon;
+ extern time_t gps_save_time;
+ extern double gps_save_lat;
+ extern double gps_save_lon;
extern int32 gps_save_id;
extern double gps_save_version;
extern char gps_save_string[GPS_ARB_LEN];
#endif
#ifdef __cplusplus
-}
+// }
#endif
#include "garminusb.h"
#include "gpsusbint.h"
+time_t gps_save_time;
+double gps_save_lat;
+double gps_save_lon;
+
#define XMIN(a,b) (a < b? a : b)
static int32 GPS_A000(const char *port);
trkpt->distance_populated = 0;
trkpt->heartrate = 0;
trkpt->cadence = 0xff;
- *trk = xrealloc(*trk, (*n+1) * sizeof(GPS_PTrack));
+ *trk = (struct GPS_STrack**) xrealloc(*trk, (*n+1) * sizeof(GPS_PTrack));
memmove(&(*trk)[i+1], &(*trk)[i], (*n-i) * sizeof(GPS_PTrack));
(*trk)[i] = trkpt;
i++;
}
/* Create & append course */
- crs = xrealloc(crs, (n_crs+1) * sizeof(GPS_PCourse));
+ crs = (struct GPS_SCourse**)xrealloc(crs, (n_crs+1) * sizeof(GPS_PCourse));
crs[n_crs] = GPS_Course_New();
if (!crs[n_crs]) {
return MEMORY_ERROR;
crs[n_crs]->track_index = Unique_Track_Index(crs, n_crs);
/* Create & append new lap */
- clp = xrealloc(clp, (n_clp+1) * sizeof(GPS_PCourse_Lap));
+ clp = (struct GPS_SCourse_Lap**) xrealloc(clp, (n_clp+1) * sizeof(GPS_PCourse_Lap));
clp[n_clp] = GPS_Course_Lap_New();
if (!clp[n_clp]) {
return MEMORY_ERROR;
}
/* Append new track points */
- ctk = xrealloc(ctk, (n_ctk+n_trk) * sizeof(GPS_PTrack));
+ ctk = (struct GPS_STrack**) xrealloc(ctk, (n_ctk+n_trk) * sizeof(GPS_PTrack));
first_new_ctk = n_ctk;
for (i=0; i<n_trk; i++) {
if (trk[i]->ishdr && (i>=n_trk || trk[i+1]->ishdr)) {
/* Convert waypoints to course points by searching closest track point &
* append
*/
- cpt = xrealloc(cpt, (n_cpt+n_wpt) * sizeof(GPS_PCourse_Point));
+ cpt = (struct GPS_SCourse_Point**) xrealloc(cpt, (n_cpt+n_wpt) * sizeof(GPS_PCourse_Point));
for (i=0; i<n_wpt; i++) {
double dist, min_dist = DBL_MAX;
int min_dist_idx = 0, trk_idx = 0, min_dist_trk_idx = 0;
#include "gpsusbint.h"
#include "gpsusbcommon.h"
+garmin_unit_info_t garmin_unit_info[GUSB_MAX_UNITS];
+
static int32 success_stub(void)
{
return 1;
static int gusb_intr_in_ep;
static int gusb_bulk_out_ep;
static int gusb_bulk_in_ep;
-static gusb_llops_t libusb_llops;
static usb_dev_handle *udev;
static int garmin_usb_scan(libusb_unit_data *, int);
static const gdx_info *gdx;
+static int gusb_libusb_get(garmin_usb_packet *ibuf, size_t sz);
+static int gusb_libusb_get_bulk(garmin_usb_packet *ibuf, size_t sz);
+static int gusb_teardown(gpsdevh *dh);
+static int gusb_libusb_send(const garmin_usb_packet *opkt, size_t sz);
+
+static gusb_llops_t libusb_llops = {
+ gusb_libusb_get,
+ gusb_libusb_get_bulk,
+ gusb_libusb_send,
+ gusb_teardown,
+ 0
+};
#if __linux__
static
// get mounted...
char ** os_get_garmin_mountpoints()
{
- char **dlist = xcalloc(2, sizeof *dlist);
+ char **dlist = (char **) xcalloc(2, sizeof *dlist);
dlist[0] = xstrdup("/Volumes/GARMIN");
dlist[1] = NULL;
return dlist;
}
}
-static gusb_llops_t libusb_llops = {
- gusb_libusb_get,
- gusb_libusb_get_bulk,
- gusb_libusb_send,
- gusb_teardown
-};
int
gusb_init(const char *portname, gpsdevh **dh)
{
int req_unit_number = 0;
- libusb_unit_data *lud = xcalloc(sizeof(libusb_unit_data), 1);
+ libusb_unit_data *lud = (libusb_unit_data*) xcalloc(sizeof(libusb_unit_data), 1);
*dh = (gpsdevh*) lud;
** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
** Boston, MA 02111-1307, USA.
********************************************************************/
+#define COMMON
#include "gps.h"
#include <stdio.h>
#ifndef gpsprotocols_h
#define gpsprotocols_h
+#ifndef COMMON
+#define COMMON extern
+#endif
+
#include "gps.h"
/*
#define pA010 10
#define pA011 11
- int32 gps_device_command;
+ COMMON int32 gps_device_command;
struct COMMANDDATA {
* Waypoint Transfer Protocol
*/
#define pA100 100
- int32 gps_waypt_transfer;
+ COMMON int32 gps_waypt_transfer;
/*
* Waypoint category transfer protocol
*/
#define pA101 101
- int32 gps_category_transfer;
+ COMMON int32 gps_category_transfer;
/*
* Route Transfer Protocol
*/
#define pA200 200
#define pA201 201
- int32 gps_route_transfer;
+ COMMON int32 gps_route_transfer;
/*
* Track Log Transfer Protocol
#define pA301 301
#define pA302 302
#define pA304 304
- int32 gps_trk_transfer;
+ COMMON int32 gps_trk_transfer;
/*
* Proximity Waypoint Transfer Protocol
*/
#define pA400 400
- int32 gps_prx_waypt_transfer;
+ COMMON int32 gps_prx_waypt_transfer;
/*
* Almanac Transfer Protocol
*/
#define pA500 500
- int32 gps_almanac_transfer;
+ COMMON int32 gps_almanac_transfer;
/*
* Date Time Transfer
*/
#define pA600 600
- int32 gps_date_time_transfer;
+ COMMON int32 gps_date_time_transfer;
/*
* FlightBook Transfer Protocol
* Position
*/
#define pA700 700
- int32 gps_position_transfer;
+ COMMON int32 gps_position_transfer;
/*
* Pvt
*/
#define pA800 800
- int32 gps_pvt_transfer;
+ COMMON int32 gps_pvt_transfer;
/*
* Lap Data Transfer
*/
#define pA906 906
- int32 gps_lap_transfer;
+ COMMON int32 gps_lap_transfer;
/*
* Various fitness related
*/
#define pA1000 1000
- int32 gps_run_transfer;
+ COMMON int32 gps_run_transfer;
#define pA1002 1002
- int32 gps_workout_transfer;
+ COMMON int32 gps_workout_transfer;
#define pA1004 1004
- int32 gps_user_profile_transfer;
+ COMMON int32 gps_user_profile_transfer;
#define pA1005 1005
- int32 gps_workout_limits_transfer;
+ COMMON int32 gps_workout_limits_transfer;
#define pA1006 1006
- int32 gps_course_transfer;
+ COMMON int32 gps_course_transfer;
#define pA1007 1007
- int32 gps_course_lap_transfer;
+ COMMON int32 gps_course_lap_transfer;
#define pA1008 1008
- int32 gps_course_point_transfer;
+ COMMON int32 gps_course_point_transfer;
#define pA1009 1009
- int32 gps_course_limits_transfer;
+ COMMON int32 gps_course_limits_transfer;
#define pA1012 1012
- int32 gps_course_trk_transfer;
+ COMMON int32 gps_course_trk_transfer;
/*
* Waypoint D Type
#define pD154 154
#define pD155 155
- int32 gps_rte_type;
- int32 gps_waypt_type;
+ COMMON int32 gps_rte_type;
+ COMMON int32 gps_waypt_type;
/*
* Waypoint category types
*/
#define pD120 120
- int32 gps_category_type;
+ COMMON int32 gps_category_type;
/*
* Rte Header Type
#define pD200 200
#define pD201 201
#define pD202 202
- int32 gps_rte_hdr_type;
+ COMMON int32 gps_rte_hdr_type;
/*
* Rte Link Type
*/
#define pD210 210
- int32 gps_rte_link_type;
+ COMMON int32 gps_rte_link_type;
/*
#define pD302 302
#define pD303 303
#define pD304 304
- int32 gps_trk_type;
- int32 gps_run_crs_trk_type;
+ COMMON int32 gps_trk_type;
+ COMMON int32 gps_run_crs_trk_type;
/*
#define pD310 310
#define pD311 311
#define pD312 312
- int32 gps_trk_hdr_type;
- int32 gps_run_crs_trk_hdr_type;
+ COMMON int32 gps_trk_hdr_type;
+ COMMON int32 gps_run_crs_trk_hdr_type;
#define pD403 403
#define pD450 450
- int32 gps_prx_waypt_type;
+ COMMON int32 gps_prx_waypt_type;
/*
#define pD550 550
#define pD551 551
- int32 gps_almanac_type;
+ COMMON int32 gps_almanac_type;
/*
*/
#define pD600 600
- int32 gps_date_time_type;
+ COMMON int32 gps_date_time_type;
*/
#define pD700 700
- int32 gps_position_type;
+ COMMON int32 gps_position_type;
*/
#define pD800 800
- int32 gps_pvt_type;
+ COMMON int32 gps_pvt_type;
/*
* Lap Data Type
#define pD1011 1011
#define pD1015 1015
- int32 gps_lap_type;
+ COMMON int32 gps_lap_type;
/*
* Various fitness related
#define pD1000 1000
#define pD1009 1009
#define pD1010 1010
- int32 gps_run_type;
+ COMMON int32 gps_run_type;
#define pD1002 1002
#define pD1008 1008
- int32 gps_workout_type;
+ COMMON int32 gps_workout_type;
#define pD1003 1003
- int32 gps_workout_occurrence_type;
+ COMMON int32 gps_workout_occurrence_type;
#define pD1004 1004
- int32 gps_user_profile_type;
+ COMMON int32 gps_user_profile_type;
#define pD1005 1005
- int32 gps_workout_limits_type;
+ COMMON int32 gps_workout_limits_type;
#define pD1006 1006
- int32 gps_course_type;
+ COMMON int32 gps_course_type;
#define pD1007 1007
- int32 gps_course_lap_type;
+ COMMON int32 gps_course_lap_type;
#define pD1012 1012
- int32 gps_course_point_type;
+ COMMON int32 gps_course_point_type;
#define pD1013 1013
- int32 gps_course_limits_type;
+ COMMON int32 gps_course_limits_type;
/*
* Link protocol type
#define pL001 1
#define pL002 2
- int32 gps_link_type;
+ COMMON int32 gps_link_type;
;
US GPS_Protocol_Version_Change(US id, US version);
- int32 GPS_Protocol_Table_Set(US id);
+ COMMON int32 GPS_Protocol_Table_Set(US id);
void GPS_Protocol_Error(US tag, US data);
void GPS_Unknown_Protocol_Print(void);
int32 GPS_Serial_On(const char *port, gpsdevh **dh)
{
- posix_serial_data *psd = xcalloc(sizeof(posix_serial_data), 1);
+ posix_serial_data *psd = (posix_serial_data*) xcalloc(sizeof(posix_serial_data), 1);
*dh = (gpsdevh*) psd;
if (!GPS_Serial_Open((gpsdevh *) psd,port)) {
}
void
-gusb_id_unit(struct garmin_unit_info *gu)
+gusb_id_unit(garmin_unit_info_t *gu)
{
static const char oid[12] =
{20, 0, 0, 0, 0xfe, 0, 0, 0, 0, 0, 0, 0};
static int trackdata;
static int trackdirection;
static int max_position_points;
-static int export_track;
static int line_width;
static int indent_level;
{ trk_coord, cb_cdata, "/Placemark/GeometryCollection/LineString/coordinates" },
{ trk_coord, cb_cdata, "/Placemark/Polygon/outerBoundaryIs/LinearRing/coordinates" },
{ trk_coord, cb_cdata, "/Placemark/LineString/coordinates" },
- { NULL, 0, NULL }
+ { NULL, (xg_cb_type) 0, NULL }
};
static
/*
* A header of a route. Related elements of a route belong to this.
*/
-typedef struct mag_rte_head {
+typedef struct mag_rte_head_ {
queue Q; /* Queue head for child rte_elems */
char *rte_name;
int nelems;
static char *
m315_cleanse(char *istring)
{
- char *rstring = xmalloc(strlen(istring)+1);
+ char *rstring = (char*) xmalloc(strlen(istring)+1);
char *i,*o;
static char m315_valid_chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789";
static char m330_valid_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
"abcdefghijklmnopqrstuvwxyz"
"0123456789+-.'/!@#<%^&>()=:\\";
- char *rstring = xmalloc(strlen(istring)+1);
+ char *rstring = (char*) xmalloc(strlen(istring)+1);
char *o, *i;
for (o=rstring,i=istring; *i; i++) {
while ((esc = strchr(ibuf, 0x1b))) {
int nremains = strlen(esc);
if (nremains >= 3) {
- static const char hex[16] = "0123456789ABCDEF";
+ static const char hex[17] = "0123456789ABCDEF";
char *c1 = strchr(hex, esc[1]);
char *c2 = strchr(hex, esc[2]);
if (c1 && c2) {
* queue head.
*/
if (frag == 1) {
- mag_rte_head = xcalloc(sizeof(*mag_rte_head),1);
+ mag_rte_head = (struct mag_rte_head_*) xcalloc(sizeof(*mag_rte_head),1);
QUEUE_INIT(&mag_rte_head->Q);
mag_rte_head->nelems = frags;
}
*p = '\0';
}
- rte_elem = xcalloc(sizeof(*rte_elem),1);
+ rte_elem = (mag_rte_elem*) xcalloc(sizeof(*rte_elem),1);
QUEUE_INIT(&rte_elem->Q);
rte_elem->wpt_name = xstrdup(next_stop);
* routepoint.
*/
if (broken_sportrak && abuf[0]) {
- rte_elem = xcalloc(sizeof(*rte_elem),1);
+ rte_elem = (mag_rte_elem*) xcalloc(sizeof(*rte_elem),1);
QUEUE_INIT(&rte_elem->Q);
rte_elem->wpt_name = xstrdup(abuf);
isrc = waypointp->notes ? waypointp->notes : waypointp->description;
owpt = global_opts.synthesize_shortnames ?
mkshort_from_wpt(mkshort_handle, waypointp) : waypointp->shortname;
- odesc = isrc ? isrc : "";
+ odesc = isrc ? isrc : (char *)"";
owpt = mag_cleanse(owpt);
if (global_opts.smart_icons &&
const char ** os_get_magellan_mountpoints()
{
#if __APPLE__
- const char **dlist = xcalloc(2, sizeof *dlist);
+ const char **dlist = (const char**) xcalloc(2, sizeof *dlist);
dlist[0] = xstrdup("/Volumes/Magellan");
dlist[1] = NULL;
return dlist;
\r
struct defguid {\r
GUID guid;\r
- char *name;\r
+ const char *name;\r
} default_guids[] = {\r
END\r
}\r
fatal(MYNAME ": merge source version is %d, requested out version is %d\n", mps_ver_temp, atoi(mpsverout));
}
} else {
- mpsverout = xmalloc(10);
+ mpsverout = (char *) xmalloc(10);
sprintf(mpsverout,"%d", mps_ver_temp);
}
}
*/
#define PRIME 37
-typedef struct {
- unsigned int target_len;
- char *badchars;
- char *goodchars;
- char *defname;
- queue namelist[PRIME];
-
- /* Various internal flags at end to allow alignment flexibility. */
- unsigned int mustupper:1;
- unsigned int whitespaceok:1;
- unsigned int repeating_whitespaceok:1;
- unsigned int must_uniq:1;
- unsigned int is_utf8:1;
-} mkshort_handle;
-
typedef struct {
queue list;
char *orig_shortname;
return hash;
}
-void *
+short_handle
#ifdef DEBUG_MEM
MKSHORT_NEW_HANDLE(DEBUG_PARAMS)
#else
#endif
{
int i;
- mkshort_handle *h = (mkshort_handle *) xxcalloc(sizeof *h, 1, file, line);
+ mkshort_handle_imp *h = (mkshort_handle_imp *) xxcalloc(sizeof *h, 1, file, line);
for (i = 0; i < PRIME; i++) {
QUEUE_INIT(&h->namelist[i]);
static
uniq_shortname *
-is_unique(mkshort_handle *h, char *name)
+is_unique(mkshort_handle_imp *h, char *name)
{
queue *e, *t;
int hash;
static
void
-add_to_hashlist(mkshort_handle *h, char *name)
+add_to_hashlist(mkshort_handle_imp *h, char *name)
{
int hash = hash_string(name);
uniq_shortname *s = (uniq_shortname*) xcalloc(1, sizeof(uniq_shortname));
}
char *
-mkshort_add_to_list(mkshort_handle *h, char *name)
+mkshort_add_to_list(mkshort_handle_imp *h, char *name)
{
uniq_shortname *s;
void
mkshort_del_handle(short_handle *h)
{
- mkshort_handle *hdr = (mkshort_handle*) *h;
+ mkshort_handle_imp *hdr = (mkshort_handle_imp*) *h;
int i;
if (!h || !hdr) {
void
setshort_length(short_handle h, int l)
{
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
if (l == 0) {
hdl->target_len = DEFAULT_TARGET_LEN;
} else {
void
setshort_whitespace_ok(short_handle h, int l)
{
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
hdl->whitespaceok = l;
}
void
setshort_repeating_whitespace_ok(short_handle h, int l)
{
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
hdl->repeating_whitespaceok = l;
}
void
setshort_defname(short_handle h, const char *s)
{
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
if (s == NULL) {
fatal("setshort_defname called without a valid name.");
}
void
setshort_badchars(short_handle h, const char *s)
{
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
if ((hdl->badchars != NULL)) {
xfree(hdl->badchars);
void
setshort_goodchars(short_handle h, const char *s)
{
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
if (hdl->goodchars != NULL) {
xfree(hdl->goodchars);
void
setshort_mustupper(short_handle h, int i)
{
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
hdl->mustupper = i;
}
void
setshort_mustuniq(short_handle h, int i)
{
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
hdl->must_uniq = i;
}
void
setshort_is_utf8(short_handle h, const int is_utf8)
{
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
hdl->is_utf8 = is_utf8;
}
char *cp;
char *np;
int i, l, nlen, replaced;
- mkshort_handle *hdl = (mkshort_handle *) h;
+ mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
if (hdl->is_utf8) {
ostring = cet_utf8_strdup(istring); /* clean UTF-8 string */
}
}
- mkshort_handle = (struct short_handle*) mkshort_new_handle();
+ mkshort_handle = mkshort_new_handle();
setshort_length(mkshort_handle, atoi(snlenopt));
if (opt_gisteq) {
return NULL;
}
- buff = xmalloc(len * sizeof(*buff));
+ buff = (gbint16*) xmalloc(len * sizeof(*buff));
gbfread(buff, sizeof(*buff), len, fin);
res = cet_str_uni_to_utf8(buff, len);
xfree(buff);
return fix_none;
}
fatal(MYNAME ": invalid fix type\n");
- return 0;
+ return fix_unknown;
}
static void
dest->rte_num = src->rte_num;
/* name in the form TRACKNAME #n */
snprintf(trk_seg_num_buf, sizeof(trk_seg_num_buf), "%d", ++trk_seg_num);
- dest->rte_name = xmalloc(strlen(src->rte_name)+strlen(trk_seg_num_buf)+3);
+ dest->rte_name = (char*) xmalloc(strlen(src->rte_name)+strlen(trk_seg_num_buf)+3);
sprintf(dest->rte_name, "%s #%s", src->rte_name, trk_seg_num_buf);
/* Insert after original track or after last newly
* By default, zero the allocated thingy.
*/
if (flags & VMFL_NOZERO) {
- vm.mem = xmalloc(size);
+ vm.mem = (char *) xmalloc(size);
} else {
vm.mem = (char *) xcalloc(size, 1);
}
* Reallocate only if we must.
*/
if (size > vm->size) {
- vm->mem = xrealloc(vm->mem, size);
+ vm->mem = (char *) xrealloc(vm->mem, size);
vm->size = size;
}
return;
}
if (wpt->gc_data != &empty_gc_data) {
- geocache_data *gc_data = xmalloc(sizeof(*gc_data));
+ geocache_data *gc_data = (geocache_data*) xmalloc(sizeof(*gc_data));
tmp->gc_data = (const geocache_data *)gc_data;
memcpy(gc_data, wpt->gc_data, sizeof(*gc_data));
wpt->url_link_text = url_link_text;
} else {
url_link *tail;
- url_link *new_link = xcalloc(sizeof(url_link), 1);
+ url_link *new_link = (url_link*) xcalloc(sizeof(url_link), 1);
new_link->url = link;
new_link->url_link_text = url_link_text;
{
geocache_data *res = (geocache_data *)wpt->gc_data;
if (res == &empty_gc_data) {
- res = xcalloc(1, sizeof(*res));
+ res = (geocache_data*) xcalloc(1, sizeof(*res));
wpt->gc_data = (const geocache_data *)res;
}
static char *port;
static char *erase;
-static enum {
+typedef enum {
UNKNOWN, WBT200, WBT201, WSG1000
-} dev_type = UNKNOWN;
+} wintec_gps_types;
+
+static wintec_gps_types dev_type = UNKNOWN;
struct buf_chunk {
struct buf_chunk *next;
static size_t buf_read(struct buf_head *h, void *data, size_t len)
{
- char *bp = data;
+ char *bp = (char *) data;
size_t got = 0;
while (len != 0 && h->current != NULL) {
struct buf_chunk *c;
size_t sz = amt + sizeof(struct buf_chunk);
- c = xmalloc(sz);
+ c = (struct buf_chunk*) xmalloc(sz);
c->next = NULL;
c->size = amt;
c->used = 0;
static void buf_write(struct buf_head *h, const void *data, size_t len)
{
size_t avail;
- const char *bp = data;
+ const char *bp = (const char *) data;
buf_update_checksum(h, data, len);
return expect("@AL,2,3,OK");
}
-static int guess_device()
+static wintec_gps_types guess_device()
{
int i;
db(1, "Guessing device...\n");